package com.banyuan.lesson.输入输出流;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/*
 * 优先使用BufferedReader 去读文本文件
 * */
public class TestBufferReader {
    public static void main(String[] args) {
        try (BufferedReader br = new BufferedReader(new FileReader("aaa.txt"))) {
            String s;
            StringBuilder sb = new StringBuilder();
            while((s=br.readLine()) != null){
                sb.append(s);
                sb.append("\n");
            }
            System.out.println(sb);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
